Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider the following ANSI C program.#includ... Start Learning for Free
Consider the following ANSI C program.
#include
int main()
{
   int arr[4][5];
   int i, j;
  for(i =0; i<4; i++)
  {
    for (j =0; j<5; j++)
    {
       arr [i][j] = 10 * i + j;
    }
  }
     print("%d", *(arr[1] + 9));
     return 0;
}
Q. What is the output of the above program?
  • a)
    14
  • b)
    20
  • c)
    30
  • d)
    24
Correct answer is option 'D'. Can you explain this answer?
Most Upvoted Answer
Consider the following ANSI C program.#includeint main(){ int arr[4][5...
Explanation:

Initialization:
- In the given ANSI C program, a 2D array 'arr' of size 4x5 is declared.
- The elements of the array are initialized using a nested for loop where arr[i][j] is assigned the value 10*i + j.

Accessing Element:
- The statement `*(arr[1] + 9)` is used to access the value at the address arr[1][9].
- Since arr is a 2D array, arr[1] represents the second row of the array and arr[1][9] represents the element at the intersection of the second row and the tenth column.

Calculation:
- The value at arr[1][9] can be calculated as 10*1 + 9 = 19.
- Therefore, the output of the program is the value at arr[1][9], which is 19.
Therefore, the correct output of the program is option 'D' which is 24.
Free Test
Community Answer
Consider the following ANSI C program.#includeint main(){ int arr[4][5...
*(arr[1] + 9) can be written as arr[1][9].
as C doesn't follow bound check and follow the row major ordering
arr[1][5] = arr[2][0]  // arr[1][4] will be first row of array and then arr[2][0] will be second row of array 
arr[1][6] = arr[2][1]
arr[1][7] = arr[2][2]
arr[1][8] = arr[2][3]
arr[1][9] = arr[2][4]
arr[2][4] = 10*i + j = 10*2+4 = 24
Option 4 is the answer.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Consider the following ANSI C program.#includeint main(){ int arr[4][5]; int i, j; for(i =0; i<4; i++) { for (j =0; j<5; j++) { arr [i][j] = 10 * i + j; } } print("%d", *(arr[1] + 9)); return 0;}Q. What is the output of the above program?a)14b)20c)30d)24Correct answer is option 'D'. Can you explain this answer?
Question Description
Consider the following ANSI C program.#includeint main(){ int arr[4][5]; int i, j; for(i =0; i<4; i++) { for (j =0; j<5; j++) { arr [i][j] = 10 * i + j; } } print("%d", *(arr[1] + 9)); return 0;}Q. What is the output of the above program?a)14b)20c)30d)24Correct answer is option 'D'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Consider the following ANSI C program.#includeint main(){ int arr[4][5]; int i, j; for(i =0; i<4; i++) { for (j =0; j<5; j++) { arr [i][j] = 10 * i + j; } } print("%d", *(arr[1] + 9)); return 0;}Q. What is the output of the above program?a)14b)20c)30d)24Correct answer is option 'D'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider the following ANSI C program.#includeint main(){ int arr[4][5]; int i, j; for(i =0; i<4; i++) { for (j =0; j<5; j++) { arr [i][j] = 10 * i + j; } } print("%d", *(arr[1] + 9)); return 0;}Q. What is the output of the above program?a)14b)20c)30d)24Correct answer is option 'D'. Can you explain this answer?.
Solutions for Consider the following ANSI C program.#includeint main(){ int arr[4][5]; int i, j; for(i =0; i<4; i++) { for (j =0; j<5; j++) { arr [i][j] = 10 * i + j; } } print("%d", *(arr[1] + 9)); return 0;}Q. What is the output of the above program?a)14b)20c)30d)24Correct answer is option 'D'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Consider the following ANSI C program.#includeint main(){ int arr[4][5]; int i, j; for(i =0; i<4; i++) { for (j =0; j<5; j++) { arr [i][j] = 10 * i + j; } } print("%d", *(arr[1] + 9)); return 0;}Q. What is the output of the above program?a)14b)20c)30d)24Correct answer is option 'D'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider the following ANSI C program.#includeint main(){ int arr[4][5]; int i, j; for(i =0; i<4; i++) { for (j =0; j<5; j++) { arr [i][j] = 10 * i + j; } } print("%d", *(arr[1] + 9)); return 0;}Q. What is the output of the above program?a)14b)20c)30d)24Correct answer is option 'D'. Can you explain this answer?, a detailed solution for Consider the following ANSI C program.#includeint main(){ int arr[4][5]; int i, j; for(i =0; i<4; i++) { for (j =0; j<5; j++) { arr [i][j] = 10 * i + j; } } print("%d", *(arr[1] + 9)); return 0;}Q. What is the output of the above program?a)14b)20c)30d)24Correct answer is option 'D'. Can you explain this answer? has been provided alongside types of Consider the following ANSI C program.#includeint main(){ int arr[4][5]; int i, j; for(i =0; i<4; i++) { for (j =0; j<5; j++) { arr [i][j] = 10 * i + j; } } print("%d", *(arr[1] + 9)); return 0;}Q. What is the output of the above program?a)14b)20c)30d)24Correct answer is option 'D'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider the following ANSI C program.#includeint main(){ int arr[4][5]; int i, j; for(i =0; i<4; i++) { for (j =0; j<5; j++) { arr [i][j] = 10 * i + j; } } print("%d", *(arr[1] + 9)); return 0;}Q. What is the output of the above program?a)14b)20c)30d)24Correct answer is option 'D'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev